package top.lyc829.zzl_android.ui.team.my_team.activity;

import android.view.View;
import android.widget.EditText;

import com.bumptech.glide.util.Util;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuexiang.xui.widget.picker.XSeekBar;
import com.xuexiang.xutil.common.StringUtils;
import com.xuexiang.xutil.data.DateUtils;

import org.jetbrains.annotations.NotNull;

import top.lyc829.zzl_android.R;
import top.lyc829.zzl_android.logic.bean.ActivityBean;
import top.lyc829.zzl_android.logic.util.Utils;

/**
 * @Author lyc
 * @create 2021-03-28 15:56
 */
public class MyActivityAdapter extends BaseQuickAdapter<ActivityBean, BaseViewHolder> {
    public MyActivityAdapter() {
        super(R.layout.add_activity_item_xseekbar);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, ActivityBean activityBean) {

        if (activityBean.getIsDelete().equals(1)) {
            baseViewHolder.setText(R.id.txt_activity_sort, "活动" + (baseViewHolder.getAdapterPosition() + 1) + "(已结束)");
        } else {
            baseViewHolder.setText(R.id.txt_activity_sort, "活动" + (baseViewHolder.getAdapterPosition() + 1));
        }



        baseViewHolder.setText(R.id.txt_base_name, activityBean.getBaseName());

        EditText editText = baseViewHolder.getView(R.id.add_activity_name);
        editText.setText(activityBean.getName());
        editText.setEnabled(false);

        baseViewHolder.setText(R.id.tv_start_date, DateUtils.millis2String(Long.parseLong(activityBean.getBeginDate()), DateUtils.yyyyMMdd.get()));
        baseViewHolder.setText(R.id.tv_end_date, DateUtils.millis2String(Long.parseLong(activityBean.getEndDate()), DateUtils.yyyyMMdd.get()));
        XSeekBar seekBar = baseViewHolder.getView(R.id.people_number);
        seekBar.setDefaultValue(activityBean.getNumber());
        seekBar.setEnabled(false);

        baseViewHolder.getView(R.id.btn_set_base).setVisibility(View.INVISIBLE);

    }
}
